package com.rockcent.mall.lib.repository;

import com.rockcent.common.common.PageResult;
import com.rockcent.common.domain.enumclass.Whether;
import com.rockcent.mall.lib.domain.Mall;
import com.rockcent.mall.lib.domain.MallOrder;
import com.rockcent.mall.lib.domain.enumclass.MallOrderStatus;
import com.rockcent.mall.lib.dto.GiftVerifyDto;
import com.rockcent.mall.lib.dto.GiftVerifyItemDto;
import com.rockcent.mall.lib.dto.MallOrderDto;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by oyhk on 14-6-22.
 */
@Repository
public interface MallOrderRepository extends JpaRepository<MallOrder, Long>, JpaSpecificationExecutor,MallOrderRepositoryCustom {

    MallOrder findByOrderNumAndMallId(String orderNum,Long mallId);
    MallOrder findByOrderNum(String orderNum);
    MallOrder findByOrderNumAndMallIdAndCustomerId(String orderNum,Long mallId,Long customerId);

    MallOrder findByIdAndMallId(Long mallOrderId, Long mallId);

    Integer countByCustomerIdAndStatusInAndIsDelete(Long id, List<MallOrderStatus> orderStatus, Whether no);

    List<MallOrder> findByGiftIdAndMallId(Long id, Long mallId);

    Long countByGiftIdAndStatusAndCustomerId(Long giftId,MallOrderStatus status,Long customerId);

    List<MallOrder> findByCustomerIdAndStatus(long l, MallOrderStatus waitPaying);

}
